<?php
/**
* This file is part of Webappkit, a packages system for PHP web apps
* @link http://webappkit.net
* @package dj
* @author J.Ducastel <jeremie@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
 * The Dj kit class : use this class for your Dj-derived kits
 * It serves as main frontcontroller for your Dj applications.
 */
class DjKit extends WakKit {

	function run() {
		// defining request and uri
		$this->request=new DjHttpRequest;
		$uri=$this->request->getUri(); // echo $uri;
		// searching route
		if (!$route=$this->urls->searchRoute($uri)) {
			// no route found, raising 404 view
			// echo "<p>404 !</p>";
			$this->response=new DjHttpResponseNotFound();
			$this->response->send();
			exit;
		}
		// searching view
		// sending response
		$this->response=new DjHttpResponse();
		$this->response->write($route);
		$this->response->send();
		echo '<pre>'; var_dump($route);
		//exit;
		//echo "<p>i was the dj kit</p><pre>";
		//print_r($this->request);
	}
}
?>
